package com.ev.k3cloud.service.impl;

import com.ev.framework.utils.HttpClientUtils;
import com.ev.framework.utils.OkHttpUtil;
import com.ev.k3cloud.config.KingdeeMiddleware;
import com.ev.k3cloud.service.kingdeeMiddlewareService;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.xmlbeans.impl.jam.mutable.MPackage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ev.k3cloud.enums.KingdeeMiddlewareWebApiOperator;

import java.util.List;
import java.util.Map;

@Service
public class kingdeeMiddlewareServiceImpl implements kingdeeMiddlewareService {
    @Autowired
    KingdeeMiddleware kingdeeMiddleware;
    @Override
    public String MaterielAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.MATERIAL_All.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);

//        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String SupplierAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.SUPPLIER_All.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);
        return resultObj;
    }

    @Override
    public String CustomerAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.CUSTOMER_All.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);
        return resultObj;
    }

    @Override
    public String StockAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.WAREHOUSE_All.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String StockPlaceAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.STOCKPLACE_All.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String DepartmentAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.DEPARTMENT_ALL.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);
        return resultObj;
    }

    @Override
    public String UserAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.USER_ALL.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);
        return resultObj;
    }

    @Override
    public String EmpAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.EMP_ALL.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String IcmoAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.ICMO_ALL.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String PPBomAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.PPBOM_ALL.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String BomAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.BOM_ALL.getUrl();
        String resultObj= OkHttpUtil.get(Url,null);
        return resultObj;
    }

    @Override
    public String SalesStorehouseAll(Map<String,String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.SALES_STORE_HOUSE_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String saveSync(String queries) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.SHENG_CHAN_DAN_HUI_SAVE_SYNC.getUrl();
        String resultObj= OkHttpUtil.postJsonParams(Url,queries,null);
        return resultObj;
    }

    @Override
    public String zuZhuangsaveSync(String queries) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.ZU_ZHUANG_RI_BAO_SAVE_SYNC.getUrl();
        String resultObj= OkHttpUtil.postJsonParams(Url,queries,null);
        return resultObj;
    }

    @Override
    public String seOutStockAll() {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.SE_OUT_STOCK_ALL.getUrl();
        String resultObj = HttpClientUtils.doGet(Url, null);
        return resultObj;
    }

    @Override
    public String materialReceiveDispatchDetailAll(Map<String,String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.MATERIAL_RECEIVE_DISPATCH_DETAIL_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String safetyInTheWarehouseStatus(Map<String,String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.SAFETY_IN_THE_WAREHOUSE_STATUS_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String expectedStatusInTheLibraryAll(Map<String, String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.EXPECTED_STATUS_IN_THE_LIBRARY_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String materialStoragePresentStateAll(Map<String, String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.MATERIAL_STORAGE_PRESENT_STATE_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String materialOutboundDetailAll(Map<String, String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.MATERIAL_OUTBOUND_DETAIL_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String finalGoodsInStockSiteAsIsAll(Map<String, String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.FINAL_GOODS_IN_STOCK_SITE_AS_IS_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }

    @Override
    public String ctWpDatabaseAll(Map<String, String> param) {
        String Url=kingdeeMiddleware.getBaseUrl()+KingdeeMiddlewareWebApiOperator.CT_WP_DATABASE_ALL.getUrl();
        String resultObj= HttpClientUtils.doGet(Url,param);
        return resultObj;
    }
}
